import request from '@/utils/request'

// @Tags api
// @Summary 分类管理
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body modelInterface.PageInfo true "分类管理"
// @Success 200 {string} json "{"code":0,"msg":"获取成功"}"
// @Router /api/category/list [post]
export const getCategory = (data) => {
  return request({
    url: '/api/category/list',
    method: 'Post',
    data
  })
}

// @Tags api
// @Summary 修改
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body modelInterface.PageInfo true "修改分类"
// @Success 200 {string} json "{"code":0,"msg":"获取成功"}"
// @Router /api/category/list [post]
export const updateCategory = (data) => {
  return request({
    url: '/api/category/update',
    method: 'Post',
    data
  })
}

// @Tags api
// @Summary 修改
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body modelInterface.PageInfo true "修改分类"
// @Success 200 {string} json "{"code":0,"msg":"获取成功"}"
// @Router /api/category/list [Get]
export const deleteCategory = (id) => {
  return request({
    url: `/api/category/delete/${id}`,
    method: 'Get'
  })
}

// @Tags api
// @Summary 添加类目
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body modelInterface.PageInfo true "添加类目"
// @Success 200 {string} json "{"code":0,"msg":"获取成功"}"
// @Router /api/category/list [Get]
export const addCategory = (data) => {
  return request({
    url: '/api/category/add',
    method: 'Post',
    data
  })
}
export const addCategoryposition = (data) => {
  return request({
    url: '/api/category/position/set',
    method: 'Post',
    data
  })
}
export const getCategoryposition = (data) => {
  return request({
    url: '/api/category/position/show',
    method: 'Post',
    data
  })
}